package com.mb.ext.base;

import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

/**
 * @Description:
 * @Author: huangwl
 * @CreateDate: 2018/12/5 17:26
 */

public class PageHelp {
    private int pageNumber = 1;
    private int pageSize = 10;

    public Pageable getPage() {
        return PageRequest.of(pageNumber - 1, pageSize);
    }

    public Pageable getPage(Sort sort) {
        return PageRequest.of(pageNumber - 1, pageSize, sort);
    }

    public int getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(int pageNumber) {
        this.pageNumber = pageNumber;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }
}

